if [ $# == 0 ]
then
  echo "Usage: problem.sh 'problem-owner-login' 'problem-name' 'letter' 'ejudge-contest-dir'"
  echo ""
  echo "This command line deploys/updates problem in the current directory for Ejudge installation from Polygon"
  echo ""
  exit 65
fi

rm -rf $4
scp -r ejudge@10.0.0.35:/home/judges/$4 .

date=$(date +%x_%X)
mkdir -p ~/.polygon/$4/$date
cp -r $4 ~/.polygon/$4/$date

pgn.sh -login admin -password zanzibar edp -contestDir $4 -url http://10.0.0.1:8080/polygon/p/$1/$2 -letter $3
cp -r $4 ejudge@10.0.0.35:/home/judges
